package controlmercancias.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;

/**
 *
 * @author Hasier
 */
public class WaitingJFrame extends JDialog {

    private static final Color fondo = new Color(255, 196, 94);

    public WaitingJFrame(String mensaje) {
        this.setUndecorated(true);
        this.setModalityType(ModalityType.APPLICATION_MODAL);
        JPanel jp = new JPanel();
        jp.setLayout(new BorderLayout(0, 10));
        JProgressBar jpb = new JProgressBar(JProgressBar.HORIZONTAL);
        jpb.setIndeterminate(true);
        jp.add(jpb, BorderLayout.CENTER);
        jp.add(new JLabel(mensaje, SwingConstants.CENTER), BorderLayout.NORTH);
        jp.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        jp.setBackground(fondo);
        this.add(jp);
        this.setBackground(fondo);
        this.setMinimumSize(new Dimension(200, 50));
        this.pack();
        this.setLocationRelativeTo(null);
    }
}
